package com.superc.server;

import javax.jdo.JDOHelper;
import javax.jdo.PersistenceManager;
import javax.jdo.PersistenceManagerFactory;

public final class StorageManager {
	
	private static final PersistenceManagerFactory pmfInstance =
        JDOHelper.getPersistenceManagerFactory("transactions-optional");

    private StorageManager() {}

    public static PersistenceManagerFactory get() {
        return pmfInstance;
    }
    
    public static void makePersistent(Object data){
    	PersistenceManager pm = pmfInstance.getPersistenceManager();
        try {
        	pm.makePersistent(data);
        } finally {
            pm.close();
        }
    	
    }
}
